package org.smile.auth.session.servlet;

import org.smile.auth.session.AbstractSession;
import org.smile.auth.session.Session;
import org.smile.auth.session.SessionListener;
import org.smile.collection.CollectionUtils;

import javax.servlet.http.HttpSession;
import java.util.Enumeration;
import java.util.Set;

public class ServletSession extends AbstractSession {
    HttpSession session;

    public ServletSession(HttpSession session){
        super(null );
        this.session=session;
    }

    @Override
    public void removeSessionListener(SessionListener listener) {

    }

    @Override
    public Object getAttribute(String name) {
        return this.session.getAttribute(name);
    }

    @Override
    public Enumeration<String> getAttributeNames() {
        return this.session.getAttributeNames();
    }

    @Override
    public Set<String> getValueNames() {
        return CollectionUtils.hashSet(this.session.getValueNames());
    }

    @Override
    public void setAttribute(String var1, Object var2) {
        this.session.setAttribute(var1,var2);
    }

    @Override
    public void putValue(String var1, Object var2) {
        this.session.putValue(var1,var2);
    }

    @Override
    public void removeAttribute(String name) {
        this.session.removeAttribute(name);
    }

    @Override
    public void removeValue(String name) {
        this.session.removeValue(name);
    }

    @Override
    public void invalidate() {
        this.session.invalidate();
    }

    @Override
    public boolean isNew() {
        return this.session.isNew();
    }
}
